#Include <..\include\Common_For_PageManager.au3>
#Include <GuiButton.au3>

AutoItSetOption("MustDeclareVars", 1)   ;Variables must be pre-declared.


Dim Const $sCorrectResultPath		 	= "C:\OCR\Correct Result\"  
Dim Const $sTestResultPath 			 	= "C:\OCR\Perform Result\"  
Dim Const $sSampleFolderPath 		 	= "C:\OCR\Sample\" 
Dim Const $sTestFolderPath 			 	= "C:\OCR\Test\" 
Dim Const $sRestoreFileFolderPath 	 	= "C:\OCR\Restore File\" 
Dim Const $iNumber 					 	= Common_GetNumberInExcelSheet($oExcel,$sOCRFunctionName)  
Dim Const $iCurrentSheetTotalLineNumber = $iNumber[0]   ;Get all number of rows in current excel sheet.
Dim Const $sFunctionFolderPath 			= "C:\OCR\"  
Global Const $sExcelSheetName = 'OCR'
Global Const $iRescolumn = 14
;Read Ini File
Dim Const $sPerformOCRTime				= Number(ReadIniKeyValue($sPCodeIniPath, $sSectionNameOCR, 'PerformOCRTime'))
Global $sCusMsg = ''
Global $sFailLogMsg = ''
Dim Const $sOCRResultView 				= ReadIniKeyValue($sPCodeIniPath, $sSectionNameOCR, "OCRResultView")


Dim Const $sSaveAsDialogClass 			= ReadIniKeyValue($sPCodeIniPath, $sSectionNameSaveAs, "SaveAsDialogClass")
Dim Const $sSaveAsDialogNameEditBox		= Number(ReadIniKeyValue($sPCodeIniPath, $sSectionNameSaveAs, 'SaveAsDialogNameEditBox'))
Dim Const $sSaveAsDialogTypeComboBox	= Number(ReadIniKeyValue($sPCodeIniPath, $sSectionNameSaveAs, 'SaveAsDialogTypeComboBox'))
Dim Const $sSaveAsDialogSaveButton		= ReadIniKeyValue($sPCodeIniPath, $sSectionNameSaveAs, 'SaveAsDialogSaveButton')


Func InitializeStatusForOCR()
	Local $FileList=_FileListToArray($sFunctionFolderPath, '*', 1)
	If @Error Then Return
	For $i = 1 to $FileList[0]
		FileDelete($sFunctionFolderPath & $FileList[$i])
	Next
EndFunc

Func SwitchToSampleFolder($hPMHandle)
	Local $hTree = ControlGetHandle($hPMHandle, "", $sTreeViewCtrInfo)
	Local $hItemFound1 = _GUICtrlTreeView_FindItem($hTree, "Sample")
	_GUICtrlTreeView_ClickItem($hTree, $hItemFound1)	
	Sleep(300)
	Common_SleepTime(2)	
	WinActivate($hPMHandle)
EndFunc